<%@ page language="java" import="com.hotel.BL.HoardingLogic" %>
<%@ page import ="java.util.List"%>
<%@ page import ="data.HoardingData"%>
<%@ page import ="java.util.Date"%>
<%@ page import ="java.text.DateFormat"%>
<%@ page import ="java.text.SimpleDateFormat"%>
<%@ page import ="java.util.Calendar"%>
<%@ page import ="java.text.DecimalFormat"%>

<link href="css/components/hoardingList/hoardingList.css" rel="stylesheet" />


<%
HoardingLogic h = new HoardingLogic();

		List<HoardingData> list = h.QueryHoarding();
	String roomname = null;
	String time =null;
	Date day ;
	double amount=0;
	double sumAmount=0;
	int i =0;
	for(HoardingData hd:list) {
	
		//เวลา
      	  day = hd.getTime();         
          DateFormat df = new SimpleDateFormat("HH:mm");
          time = df.format(day);
     

           roomname = hd.getRoom();
           amount = hd.getAmount();
           sumAmount += amount;
        out.print(roomname+"<br/>"+amount+"<br/>"+time+"<br/>");
        i++;
                    } 
                 %>
              
                 <%  
                    
                    String totalMoney = Double.toString(sumAmount);
                    out.print(totalMoney);
                    if(totalMoney.indexOf(".") > 0){
                    DecimalFormat formatter = new DecimalFormat("###,###,###.00");
                    String totalMoneyOne = formatter.format(sumAmount);
                    out.println(totalMoneyOne);
                    }else{
                    
                    DecimalFormat formattertwo = new DecimalFormat("###,###,###.##");
                    
                    String totalMoneyTwo= formattertwo.format(sumAmount);
                    out.println(totalMoneyTwo);
                    }
		 
		 // out.print( sumAmount);
		%>

